﻿onmessage = function (evt) {
    var d = evt.data;
    getData(d);
}
var xmlHttpRequest;

function getData(data) {
    var url = data.split(',')[0].split(':')[1];
    xmlHttpRequest = new XMLHttpRequest();
    xmlHttpRequest.onreadystatechange = callBack;
    xmlHttpRequest.open("GET", url, true);
    xmlHttpRequest.send();
}

function callBack() {
    if (xmlHttpRequest.readyState == 4) {
        if (xmlHttpRequest.status == 200) {
            var response = xmlHttpRequest.responseText;
            postMessage(eval("(" + response + ")"));
            //setTimeout(function () { postMessage(eval("(" + response + ")")); }, 3000);
        }
    }
}